<template>
    <div class="article">
        <div class="article-title">{{item.title}}</div>
        <div class="article-about clear">
            <span class="article-time">发布时间：{{item.created_at}}</span>
            <span class="article-from">来源：{{item.source}}</span>
            <span id="change-font-size">A+</span>
        </div>
        <div class="dashed"></div>
        <div class="article-content" id="content" v-if="setContent(item.content)" v-html="showContent"></div>
        <div class="article-foot">
        		<div class="show-all" v-if="showAllFlag" @click="showAll()"><span>显示全文</span></div>
            <span class="article-author">编辑：{{item.uname}}</span>
            <div class="clear"></div>
        </div>
    </div>
</template>

<script>
	import $ from 'jquery'
	import store from '@/store'
	export default {
		name: 'swiper',
		props: ['item', "category"],
		data: function() {
			return {
				allContent: "all",
				showContent: "",
				showAllFlag: false
			}
		},
		computed: {
		},
		methods: {
			toList: function() {
				this.$router.push('/list')
			},
			setPath: function() {
					return '/detail'
			},
			setImage: function(url) {
				return store.state.StaticStore.baseUrl + '/data/' + url
			},
			setContent: function(str) {
				this.allContent = new String(str).split("_ueditor_page_break_tag_").join("")
				if (this.showContent != this.allContent) {
					this.showContent = new String(str).split("_ueditor_page_break_tag_")[0].toString()
					this.showAllFlag = true
				} else {
					this.showAllFlag = false
				}
				return true
			},
			showAll: function() {
				this.showContent = this.allContent
				this.showAllFlag = false
			}
		}
	}
</script>